
import axios from "axios";
axios.defaults.baseURL = "http://47.93.2.50:7500"
// axios.defaults.baseURL = "http://localhost:9000"
// promise方法请求
export function change_banner(url,dispatch){
    return new Promise((resolve,reject)=>{
        return axios.get(url)
            .then(res=>res.data)
            .then(json=>{
               dispatch({type:"change_banner",json})
            // console.log(json)
            })
    })
}

export function change_indexContent(url,dispatch){
    return new Promise((resolve,reject)=>{
        return axios.get(url)
            .then(res=>res.data)
            .then(json=>{
               dispatch({type:"change_indexContent",json})
            // console.log(json)
            })
    })
}


export function change_college(url,dispatch){
    return new Promise((resolve,reject)=>{
        return axios.get(url)
            .then(res=>res.data)
            .then(json=>{
               dispatch({type:"change_college",json})
            // console.log(json)
            })
    })
}


export function change_play(url,dispatch){
    return new Promise((resolve,reject)=>{
        return axios.get(url)
            .then(res=>res.data)
            .then(json=>{
               dispatch({type:"change_play",json})
            })
    })
}

export function change_hot(url,dispatch){
    return new Promise((resolve,reject)=>{
        return axios.get(url)
            .then(res=>res.data)
            .then(json=>{
               dispatch({type:"change_hot",json})
            // console.log(json)
            })
    })
}


// export function login(url,dispatch){
//     return new Promise((resolve,reject)=>{
//         return axios.get(url)
//             .then(res=>res.data)
//             .then(json=>{
//                dispatch({type:"login",json})
//             console.log(json)
//             })
//     })
// }